//
//  MainVC.swift
//  weibo10
//
//  Created by Apple on 16/5/10.
//  Copyright © 2016年 Apple. All rights reserved.
//

import UIKit

class MainVC: UITabBarController {
    

    override func viewDidLoad() {
        super.viewDidLoad()


        
        
        let tabbar = CWtabbar()
        
        let modelVC = {
            () -> () in
            
            print("Modal出控制器")
            
        }
        
        tabbar.modelVC = modelVC
     
        self.setValue(tabbar, forKey: "tabBar")
        
        self.setVC()
      
      
    }
    
    func setVC()
    {
    
        self.addChildViewController(CWDiscoveryVC(), title: "首页", image: "tabbar_home")
        
        self.addChildViewController(CWMessageVC(), title: "消息", image: "tabbar_message_center")
        
        self.addChildViewController(CWDiscoveryVC(), title: "发现", image: "tabbar_discover")
        
        
        self.addChildViewController(CWDiscoveryVC(), title: "我", image: "tabbar_profile")
        
    }
    
    func addChildViewController(childController: UIViewController,title:String,image:String)
    {
        
        let VC:UIViewController = childController
        self.addChildViewController(UINavigationController(rootViewController: VC))
        VC.title = title
        VC.tabBarItem.image = UIImage(named:image)
        
        
    }

  



}
